package com.vgmobile.cucrever2.home;

import java.util.ArrayList;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.vgmobile.cucrever2.R;
import com.vgmobile.cucrever2.api.ItemListHoz;
import com.viewpagerindicator.IconPagerAdapter;

public class HomeEventAdapter extends FragmentPagerAdapter implements IconPagerAdapter {
    private ArrayList<ItemEvent> listItem;

    public HomeEventAdapter(FragmentManager fragmentManager, ArrayList<ItemEvent> listItem) {
    	super(fragmentManager);
    	this.listItem = listItem;
    }

    @Override
    public Fragment getItem(int position) {
        return HomeEventFragment.newInstance(listItem.get(position).getImageLink());
    }

    @Override
    public int getCount() {
        return listItem.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
      return listItem.get(position).getEventName();
    }

    @Override
    public int getIconResId(int index) {
      return R.drawable.ic_launcher;
    }
}